package com.atguigu.gmall.order.rpc;

import com.atguigu.gmall.order.service.OrderBizService;
import com.atguigu.gmall.order.vo.ToWareOrderSpiltVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description
 * @Return
 * @Author https://weiranyi.github.io
 * @Date Created in 2022-12-21 09:01
 **/
@RequestMapping("/api/order")
@RestController
public class OrderSplitController {
    @Autowired
    OrderBizService orderBizService;

    // 【POST】http://api.gmall.com/api/order/orderSplit?orderId=xxx&wareSkuMap=xxx
    @PostMapping("/orderSplit")
    public List<ToWareOrderSpiltVo> splitOrder(@RequestParam("orderId") Long orderId,
                                               @RequestParam("wareSkuMap") String wareSkuMap) {
        List<ToWareOrderSpiltVo> childOrderInfos = orderBizService.splitOrder(orderId, wareSkuMap);
        return childOrderInfos;
    }
}
